package com.zy.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zy.bean.Didian;
import com.zy.lcpassenger.R;


import java.util.ArrayList;

/**
 * Created by Administrator on 2016/6/21 0021.
 */
public class DizhiAdapter extends BaseAdapter {


    Context context;
    ArrayList<Didian> arrayList;
    String biaoshi;

    public DizhiAdapter(Context context,ArrayList<Didian> arrayList,String biaoshi){
        this.context = context;
        this.arrayList = arrayList;
        this.biaoshi = biaoshi;
    }

    @Override
    public int getCount() {
        return arrayList.size();
    }

    @Override
    public Object getItem(int position) {
        return arrayList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null){
            convertView = LayoutInflater.from(context).inflate(R.layout.item_dizhi, parent,false);
            holder = new ViewHolder();
            holder.address = (TextView) convertView.findViewById(R.id.address);
            holder.adname = (TextView) convertView.findViewById(R.id.adname);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        holder.adname.setText(arrayList.get(position).getAdname());
        holder.address.setText(arrayList.get(position).getAddress());

        return convertView;

    }

    class ViewHolder{

        TextView adname,address;
    }

}
